<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
         Function.prototype.myCall = function(thisArg,...args)
         {
            if(typeof this !="function")
            {
              throw TypeError(thisArg+"不是函数");
            }
            thisArg = thisArg||globalThis;
            const fnArg = Symbol();
            thisArg[fnArg] = this;
            const result =  thisArg[fnArg](...args); 
            delete thisArg[fnArg];
            return result;
         }

         function sum(a,b)
         {
            return a+b;
         }

         const obj = {
            name:'cq',
            age:'19'
         }

         const result = sum.myCall(obj,10,10);
         console.log(result);
        
    </script>
</body>
</html>